<?php
namespace yan\currency\factory;
class FixerIo extends \yan\currency\AbstractFactory{
	public function run($service){
		$param['access_key'] =  getenv('FIXERIO');
		// $param['base'] =  'USD'; // Free no support,upper Basic plan support
		// $param['symbols'] =  'GBP,JPY,EUR,HKD,CNY';
		$url = 'http://data.fixer.io/api/latest?'. http_build_query($param);
		$response = $service->curl->build($url)->run();
		$data = json_decode($response, true);

		$currencies = [];
		$currencies['EUR'] = '1.0000';
		if(!empty($data['rates'])){
			$currencies = array_merge($currencies, $data['rates']);
		}
		return $currencies;
	}
}